#pragma once
#include "SellPos.h"
#include "Vector3.h"
#include "FrameAnimate.h"
#include <list>
using std::list;

class Sell;
class Block;
class MapLoader;
typedef list<Sell*> SELL_LIST;
typedef list<FrameAnimate> FRAMEANIMATE_LIST;
class SellArray
{
private:
	enum
	{
		EN_SellMaxNumX = 30,
		EN_SellMaxNumY = 30,
	};
	
	FRAMEANIMATE_LIST _fanimateList;
	Sell* _sells[EN_SellMaxNumY][EN_SellMaxNumX];
	Vector3f _position;

	void setSellType(SellPos sp, Sell* t);
	void addHitAnimate(Block source, Block target);
	void addHitAnimate(Vector3f pos);
public:
	SellArray(void);
	~SellArray(void);

	Sell* operator()(int x, int y){return _sells[y][x];}
	Sell* operator()(SellPos sp){return _sells[sp.getY()][sp.getX()];}

	void init(int x, int y);
	void display();
	bool existBlock(SellPos sp);
	void giveBlock(SellPos sp, Block* b);
	void update();
	void setPosition(Vector3f p);
	SELL_LIST getMoveBlockList();
	list<Vector3f> getForecastBlockPos(SellPos start, Vector3l way);
	SellPos getFindSellPos(Sell* s);
	void updateMoveBlockList();
	bool checkRunAnimation();
	void loadMap(MapLoader* ml);

	bool checkSuccess();
};

